﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Trancity
{
    public partial class StopListForm : Form
    {
        public Trip trip;

        public StopListForm()
        {
            InitializeComponent();
        }

        private void StopListForm_Load(object sender, EventArgs e)
        {
            if (trip.tripStopList == null)
            {
                trip.InitTripStopList();
            }
            for (int i = 0; i < trip.tripStopList.Count;i++ )
            {
                checkedListBox.Items.Add(trip.tripStopList[i].stop.название);
                checkedListBox.SetItemChecked(i, trip.tripStopList[i].flag);
            }
        }

        private void StopListForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            for (int i = 0; i < trip.tripStopList.Count; i++)
            {
                trip.tripStopList[i].flag=checkedListBox.GetItemChecked(i);
            }
        }
    }
}
